<script setup>
import { useRoute, useRouter } from 'vue-router';

// 获取路由信息
const route = useRoute();
const router = useRouter();

// 定义 props
const props = defineProps({
  id: {
    type: String,
    required: true
  }
});
</script>

<template>
  <div class="page-container">
    <nav class="top-bar">
      <div class="nav-links">
        <router-link to="/shouye" class="nav-link">首页</router-link>
        <router-link to="/shoufei" class="nav-link">药品查看</router-link>
        <router-link to="/yiliaoguanli" class="nav-link">医疗项目查看</router-link>
      </div>
      <div class="user-section">
        <div class="user-info">{{ $route.params.id }}用户</div>
        <button class="logout-button" @click="router.push('/')">退出</button>
      </div>
    </nav>
    <div class="tab-content">
      <router-view></router-view>
    </div>
  </div>
</template>

<style scoped>
.page-container {
  min-height: 100vh;
  background-image: linear-gradient(to bottom, #ffffff, #e0f2ff);
}

.top-bar {
  background: linear-gradient(to right, #3979da, #4273bd);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-links {
  display: flex;
  gap: 500px;
}

.nav-link {
  color: white;
  text-decoration: none;
  margin-right: 30px;
  font-size: 18px;
  transition: color 0.3s ease;
}

.nav-link:hover {
  color: #e0f2ff;
  text-decoration: none;
}

.user-section {
  text-align: right;
}

.user-info {
  color: white;
  font-size: 16px;
  margin-bottom: 5px;
}

.logout-button {
  background-color: transparent;
  border: 2px solid #e0f2ff; /* 增加边框宽度，改变边框颜色 */
  color: rgb(147, 146, 173);
  padding: 3px 16px; /* 调整内边距 */
  border-radius: 8px; /* 增加圆角半径 */
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 16px; /* 调整字体大小 */
  font-weight: 500; /* 增加字体粗细 */
  letter-spacing: 0.5px; /* 增加字间距 */
}

.logout-button:hover {
  background-color: white;
  color: #5050d1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 增加鼠标悬停时的阴影效果 */
}

.tab-content {
  padding: 20px;
}
</style>    